<template>
  <div class="flex justify-end mt-3">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "TMPagination",
  props: {
    currentPage: {
      type: Number,
      default() {
        return 1
      }
    },
    pageSize: {
      type: Number,
      default: 10
    },
    total: {
      type: Number,
      default() {
        return 10
      }
    }
  },
  methods: {
    handleSizeChange(val) {
      this.$emit('update:pageSize', val)
      this.$emit('updateTable')
    },
    handleCurrentChange(val) {
      this.$emit('update:currentPage', val)
      this.$emit('updateTable')
    }
  }
}
</script>

<style scoped>

</style>
